package com.spring.demo1;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author wdd-think
 * @desc:InitializingBean:afterPropertiesSet();DisposableBean:destroy()
 */
public class HelloWorld implements InitializingBean,DisposableBean{

	private String message;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	////////////自定义初始化，销毁///////////////
	public void myinit(){
		System.out.println("我被初始化了。。。");
	}
	public void mydestroy(){
		System.out.println("我被销毁了。。。");
	}
	////////////默认初始化，销毁///////////////
	public void defaultinit(){
		System.out.println("default我被初始化了。。。");
	}
	public void defaultdestroy(){
		System.out.println("default我被销毁了。。。");
	}
	////////////通过接口实现初始化，销毁///////////////
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("实现接口完成初始化bean");
	}

	@Override
	public void destroy() throws Exception {
		System.out.println("实现接口销毁bean");
	}
}
